home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / ABox 1.9.5 / ABox info... / About the ABox... / Programming Info / 2-Modifying source / 2-Modifying source.rsrc / TEXT_230_modify the ABox.txt < prev    next >
Encoding:
Text File  |  1994-07-13  |  4.7 KB  |  124 lines

  1. The ABox class provides a pair of methods to get and set various characteristics or properties of the ABox. These properties allow you, the application programmer, to specify the root of the topic/slide folder tree, if the ABox should be modal, moveable modal, or modeless, if it should behave as a splash screen that waits for a click, shows for a brief time then vanishes, or vanishes under application control (useful for initialization time), etc. The methods you use to alter these properties are, appropriately named, GetProperty and SetProperty, and are shown below as prototypes:
  2.  
  3. OSErr ABox::GetProperty (ABProperty prop, void *ptr, long *ptrSize);
  4. OSErr ABox::SetProperty (ABProperty prop, void *ptr, long ptrSize);
  5.         
  6. The list of properties is provided in the ABox.h file; the code fragment below is an example of how to setup some of the various properties of the ABox [ the code has been reformatted to fit into the ABox more easily so you can read it better; really, the actual code is much neater, I promise ;^) ]:
  7.  
  8.  
  9. OSErr    
  10. PrepareABox (ABox *abox, 
  11.              ABoxSplashTimeType splashTimeSeconds, 
  12.              ABoxModalIndicator modality, 
  13.              FSSpecPtr homeSpec)
  14. {
  15. OSErr            error = noErr;
  16.     
  17. StringHandle           nameAndVersion = 
  18.                     (StringHandle)NewHandleClear(sizeof(Str255));
  19. StringHandle           modalityString = 
  20.                     (StringHandle)NewHandleClear(sizeof(Str255));
  21. ABIndex                      firstItem = 1;
  22. ABoxTextFontType textFace = 0;
  23. ABoxTextFontType textSize = 9;
  24. ABoxTextFontType textFont = geneva;
  25.     
  26. UpdateWindowUPP        windowUpdater = NewWindowUpdateProc(HandleUpdate);
  27.     
  28. //    begin here...
  29.     
  30. if (!abox)
  31.    return paramErr;
  32.         
  33. error = abox->SetProperty (kABoxModalIndicator, 
  34.                            &modality, 
  35.                            kABoxModalIndicatorSize);
  36. error = abox->SetProperty (kABoxSplashTimeSeconds, 
  37.                            &splashTimeSeconds,
  38.                            sizeof(splashTimeSeconds));
  39. error = abox->SetProperty (kABoxHomeFolder, 
  40.                            homeSpec, 
  41.                            kABoxHomeFolderSize);
  42. error = abox->SetProperty (kABoxAppResFile, 
  43.                            &gAppResFile, 
  44.                            sizeof(gAppResFile));
  45. error = abox->SetProperty (kABoxFirstTopicNumber, 
  46.                            &firstItem, 
  47.                            sizeof(firstItem));
  48. error = abox->SetProperty (kABoxFirstSlideNumber, 
  49.                            &firstItem, 
  50.                            sizeof(firstItem));
  51. error = abox->SetProperty (kABoxTextFont, 
  52.                            &textFont, 
  53.                            sizeof(textFont));
  54. error = abox->SetProperty (kABoxTextFace, 
  55.                            &textFace, 
  56.                            sizeof(textFace));
  57. error = abox->SetProperty (kABoxTextSize, 
  58.                            &textSize, 
  59.                            sizeof(textSize));
  60. error = abox->SetProperty (kABoxUpdater, 
  61.                            &windowUpdater, 
  62.                            kABoxUpdaterSize);
  63.     
  64. switch (splashTimeSeconds)
  65. {
  66.    case    kABoxNoSplash:
  67.       SetString (nameAndVersion, 
  68.                  "\pNo splash screen.");
  69.       break;
  70.    case    kABoxWaitForClickSplash:
  71.       SetString (nameAndVersion,
  72.                  "\pWait for click splash screen...please click.");
  73.       break;
  74.    case    kABoxWaitForApplicationSplash:
  75.       SetString (nameAndVersion,
  76.                  "\pApplication controlled splash screen...");
  77.       break;
  78.    default:
  79.       SetString (nameAndVersion,
  80.                  "\pTimed splash screen...just watch...");
  81.       break;
  82. } // end switch block
  83.     
  84.     switch (modality)
  85.     {
  86.    case    kABoxModal:
  87.       SetString (modalityString,
  88.                  "\pModal Dialog");
  89.       break;
  90.    case    kABoxModeless:
  91.       SetString (modalityString, 
  92.                  "\pModeless Dialog");
  93.       break;
  94.    case    kABoxMoveableModal:
  95.       SetString (modalityString, 
  96.                  "\pMoveable Modal Dialog");
  97.       break;
  98.    default:
  99.       SetString (modalityString,
  100.                  "\pClueless Dialog");
  101.       break;
  102. } // end switch block
  103.     
  104. error = HandAndHand ((Handle)modalityString, 
  105.                      (Handle)nameAndVersion);
  106.     
  107. HLock ((Handle)nameAndVersion);
  108. error = abox->SetProperty (kABoxAppNameAndVersion, 
  109.                                                                                                 *nameAndVersion, 
  110.                                                                                                    **nameAndVersion + 1);
  111. HUnlock ((Handle)nameAndVersion);
  112.     
  113. HLock ((Handle)modalityString);
  114. error = abox->SetProperty (kABoxWindowTitle, 
  115.                            *modalityString, 
  116.                            **modalityString + 1);
  117. HUnlock ((Handle)modalityString);
  118.     
  119. return error;
  120.  
  121. } // end PrepareABox
  122.  
  123.  
  124. Remember: this is just an example. You should check out the example program "ABoxText" and its source for a real world example of how to implement the ABox.